import React from 'react'
import { openImageWindow } from './openImageWindow'
import style from './basic.scss'

export const genBase64Url = base64 => base64 ? `data:image/png;base64,${base64}` : ''

export const genImageFromBase64 = (base64, openNewWinOnClick) => base64
    ? <img className={style.screen_shot_img} src={genBase64Url(base64)} title={openNewWinOnClick ? '点击在新窗口打开图片' : ''}
        onClick={openNewWinOnClick ? openImageWindow(base64) : null} />
    : null